<?php
	function get_detail_jual($KdJual){
		$_this = & get_Instance();
		$sql="SELECT * FROM detail_jual 
			INNER JOIN obat ON detail_jual.KdObat = obat.KdObat
			WHERE KdJual = '".$KdJual."'";
		$query = $_this->db->query($sql);
		if ($query->num_rows() > 0) {
			$result = $query->result_array();
			$query->free_result();
		}else{
			$result = array();
		}
		return $result;
	}

	function get_detail_jual_by($KdJual,$kelompok,$obat){
		if($kelompok != ''){
			$where_kelompok = "AND obat.KdKelompok = ".$kelompok."";
		}else{
			$where_kelompok = "";
		}
		if($obat != ''){
			$where_obat = "AND obat.KdObat = ".$obat."";
		}else{
			$where_obat = "";
		}

		$_this = & get_Instance();
		$sql="SELECT * FROM detail_jual 
			INNER JOIN obat ON detail_jual.KdObat = obat.KdObat
			WHERE KdJual = '".$KdJual."'
			".$where_kelompok."
			".$where_obat."";
		$query = $_this->db->query($sql);
		if ($query->num_rows() > 0) {
			$result = $query->result_array();
			$query->free_result();
		}else{
			$result = array();
		}
		return $result;
	}
?>